package com.connectlinkcorp.common.ui.demo;

import java.util.ArrayList;

import com.connectlinkcorp.common.ui.horizontalscrollnumbertiles.HorizontalScrollNumberTiles;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Toast;

public class HorizontalScrollNumberTilesActivity extends Activity{
	int imageDigit[] = new int[]{
			R.drawable.digit00,R.drawable.digit01,R.drawable.digit02,R.drawable.digit03,R.drawable.digit04,
			R.drawable.digit05,R.drawable.digit06,R.drawable.digit07,R.drawable.digit08,R.drawable.digit09,
			R.drawable.digit10,R.drawable.digit11,R.drawable.digit12,R.drawable.digit13,R.drawable.digit14,
			R.drawable.digit15,R.drawable.digit16,R.drawable.digit17,R.drawable.digit18,R.drawable.digit19,
			R.drawable.digit20,R.drawable.digit21,R.drawable.digit22,R.drawable.digit23,R.drawable.digit24,
			R.drawable.digit25,R.drawable.digit26,R.drawable.digit27,R.drawable.digit28,R.drawable.digit29,
			R.drawable.digit30,R.drawable.digit31,R.drawable.digit32,R.drawable.digit33,R.drawable.digit34,
			R.drawable.digit35,R.drawable.digit36,R.drawable.digit37,R.drawable.digit38,R.drawable.digit39,
			R.drawable.digit40,R.drawable.digit41,R.drawable.digit42,R.drawable.digit43,R.drawable.digit44,
			R.drawable.digit45,R.drawable.digit46,R.drawable.digit47,R.drawable.digit48,R.drawable.digit49,
			R.drawable.digit50,R.drawable.digit51,R.drawable.digit52,R.drawable.digit53,R.drawable.digit54,
			R.drawable.digit55,R.drawable.digit56,R.drawable.digit57,R.drawable.digit58,R.drawable.digit59,
			R.drawable.digit60,R.drawable.digit61,R.drawable.digit62,R.drawable.digit63,R.drawable.digit64,
			R.drawable.digit65,R.drawable.digit66,R.drawable.digit67,R.drawable.digit68,R.drawable.digit69,
			R.drawable.digit70,R.drawable.digit71,R.drawable.digit72,R.drawable.digit73,R.drawable.digit74,
			R.drawable.digit75,R.drawable.digit76,R.drawable.digit77,R.drawable.digit78,R.drawable.digit79,
			R.drawable.digit80,R.drawable.digit81,R.drawable.digit82,R.drawable.digit83,R.drawable.digit84,
			R.drawable.digit85,R.drawable.digit86,R.drawable.digit87,R.drawable.digit88,R.drawable.digit89,
			R.drawable.digit90,R.drawable.digit91,R.drawable.digit92,R.drawable.digit93,R.drawable.digit94,
			R.drawable.digit95,R.drawable.digit96,R.drawable.digit97,R.drawable.digit98,R.drawable.digit99};
		HorizontalScrollNumberTiles numberView;
		ArrayList<Integer> numbers;
		
		@Override
		protected void onCreate(Bundle savedInstanceState) {
			// TODO Auto-generated method stub
			super.onCreate(savedInstanceState);
			setContentView(R.layout.activity_horizontalscrollnumbertiles);
			int [] numbersArr = new int []{1, 2, 12 ,2, 2, 12};
			numbers = new ArrayList<Integer>();
			for (int i = 0; i < numbersArr.length; i++) {
				numbers.add(numbersArr[i]);
			}
			numberView = (HorizontalScrollNumberTiles)findViewById(R.id.numberTileView);
			
			// set up param
			numberView.setUpParam(this,4,50,150,400,200,numbers);
			// set resource background for digit
			numberView.setImageDigit(imageDigit);
			// show number
			numberView.show();
			// set click event
			numberView.setItemClicked(new OnClickListener() {
				
				@Override
				public void onClick(View v) {
					// TODO Auto-generated method stub
					Toast.makeText(HorizontalScrollNumberTilesActivity.this,
							String.valueOf(numberView.getNumbers().get(v.getId())), Toast.LENGTH_SHORT).show();
				}
			});
			
		}
		
}

















